' 
' Copyright (C) 2014 Infinity CCS Ltd (http://www.infinityccs.com/)
' Copyright (C) 2008 Sasa Coh <sasacoh@gmail.com>
'
' This program is free software; you can redistribute it and/or modify
' it under the terms of the GNU General Public License as published by
' the Free Software Foundation; either version 3 of the License, or
' (at your option) any later version.
'
' This program is distributed in the hope that it will be useful,
' but WITHOUT ANY WARRANTY; without even the implied warranty of
' MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
' GNU General Public License for more details.
'
' You should have received a copy of the GNU General Public License
' along with this program.  If not, see <http://www.gnu.org/licenses/>. 
'/


Imports System
Imports System.Collections.Generic
Imports System.Text
Imports Infinity.pjsipNET.CallControl.CallState

Namespace Common

  ''' <summary>
  ''' AbstractFactory is an abstract interface providing interfaces for CallControl module. 
  ''' It consists of two parts: factory methods and getter methods. First creates instances, 
  ''' later returns instances. 
  ''' </summary>
  Public MustInherit Class IFactory
    ''' <summary>
    ''' Factory creator. Creates new instance of timer 
    ''' </summary>
    ''' <returns>ITimer instance</returns>
    MustOverride Function createTimer() As Timer.ITimer

    ''' <summary>
    ''' State machine factory. Use this method to create your own call state machine class.
    ''' </summary>
    ''' <returns></returns>
    MustOverride Function createStateMachine() As CallState.IStateMachine

#Region "Null Pattern"
    ''' <summary>
    ''' Null Factory implementation
    ''' </summary>
    Friend Class NullFactory
      Inherits IFactory

#Region "AbstractFactory members"
      '// factory methods
      Public Overrides Function createTimer() As Timer.ITimer
        Return New Timer.NullTimer()
      End Function

      Public Overrides Function createStateMachine() As CallState.IStateMachine
        Return New CallControl.CallMachine()
      End Function

#End Region
    End Class
#End Region
  End Class



End Namespace